// @ts-ignore
/* eslint-disable */

import { request, type RequestOptions } from '@/utils/request';

/**
 * 获取角色列表
 * @param input 角色搜索参数
 * @returns
 */
export async function roles(input: RoleSearch, options?: RequestOptions) {
  return request<RoleSearchOut>(`role/roles`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 获取所有角色
 * @returns
 */
export async function getRoles(options?: RequestOptions) {
  return request<RoleOut>(`role/roles`, {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 物理删除角色
 * @param id 角色ID
 * @returns
 */
export async function realDelete(id: string, options?: RequestOptions) {
  return request<string>(`role/${id}/real-delete`, {
    method: 'POST',
    ...(options || {}),
  });
}

/**
 * 获取角色详情
 * @param id 角色ID
 * @returns
 */
export async function get(id: string, options?: RequestOptions) {
  return request<RoleOut>(`role/${id}`, {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 编辑角色
 * @param input 角色信息
 * @returns
 */
export async function edit(input: RoleOut, options?: RequestOptions) {
  return request<string>(`role/edit`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 设置角色菜单
 * @param input 角色菜单列表
 * @returns
 */
export async function menus(input: Array<RoleMenuOut>, options?: RequestOptions) {
  return request<string>(`role/menus`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 获取角色菜单
 * @param id 角色ID
 * @returns
 */
export async function getMenus(id: string, options?: RequestOptions) {
  return request<RoleMenuOut>(`role/${id}/menus`, {
    method: 'GET',
    ...(options || {}),
  });
}
